''' Mission 9 - Game Spinner Using a traversal for the list Includes a user-defined list for arrows ''' from codex import * import random from time import sleep # Used my own arrow list so I know exactly what # the elements are, and it includes pics. MY_ARROW_LIST = [ pics.ARROW_N, pics.ARROW_NE, pics.ARROW_E, pics.ARROW_SE, pics.ARROW_S, pics.ARROW_SW, pics.ARROW_W, pics.ARROW_NW ] def show_random_arrow(): # Can use the choice method for lists – but it doesn’t have to be this display.show(random.choice(MY_ARROW_LIST)) # Modify the code to traverse the list of arrows # Will also affect the count -- Change the argument # to count for the number of traversals # instead of number of arrows def spin_animation(count): loops = 0 delay = 0.005 while loops < count: for item in MY_ARROW_LIST: display.show(item) sleep(delay) #delay will only be incremented after each traversal delay = delay + 0.02 loops = loops + 1 while True: if buttons.is_pressed(BTN_A) or buttons.is_pressed(BTN_B): spin_animation(3) show_random_arrow() if buttons.is_pressed(BTN_U): break